import java.util.*;
public class test1 {
    //二分法
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] s=new int[]{1,2};
        int n=sc.nextInt();
        int target=sc.nextInt();
        int[] ints=new int[n];
        int a=0;
        int b=0;
        for(int i=0;i<n;i++){
            ints[i]=sc.nextInt();
        }
        int left=0;
        int right=n-1;
        while (left<right){
            int mid=left+(right-left)/2;
            if(ints[mid]>=target) right=mid;
            else left=mid+1;
        }
        if(ints[left]==target) a=left;
        else a=-1;
        left=0;
        right=n-1;
        while (left<right){
            int mid=left+(right-left+1)/2;
            if(ints[mid]<=target) left=mid;
            else right=mid-1;
        }
        if(ints[left]==target) b=left;
        else b=-1;
        System.out.println("["+a+","+b+"]");
    }
    public static void main1(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        int[] ints=new int[n];
        int[] ints2=new int[m];
        for(int i=0;i<n;i++){
            ints[i]=sc.nextInt();
        }
        for(int i=0;i<m;i++){
            ints2[i]=sc.nextInt();
        }
        int target=0;
        int left=0,right=n-1;
        int mid=0;
        for(int i=0;i<m;i++) {
            target=ints2[i];
            if(target>ints[n-1]||target<ints[0]) {
                if(i!=m-1)
                    System.out.print(-1+" ");
                else
                    System.out.print(-1);
                continue;
            }
            left=0;
            right=n-1;
            while ((left<right)){
                mid=left+(right-left)/2;
                if(ints[mid]>=target)
                    right=mid;
                else if (ints[mid]<target)
                    left=mid+1;
                }
                if(ints[left]==target) {
                    if(i!=m-1)
                        System.out.print((left+1) + " ");
                    else
                        System.out.print((left+1));
                }
                else {
                    if(i!=m-1)
                        System.out.print(-1 + " ");
                    else
                        System.out.print(-1);
                }
            }
        }
    }
